from robot.api import logger
from robotlibcore import keyword

from .Model import Model


class BgwModel(object):

    def __init__(self):

        self.m = Model()
        self.config_info_table = "bgw_business_access_config_info"
    
    @keyword('Create A Bgw Config')
    def create_a_bgw_config(self, appCode, areaCode, BType, TType, Address, AMode="page"):

        data = {}
        data['appcode'] = appCode
        data['areacode'] = areaCode
        data['access_business_type'] = BType
        data['access_terminal_type'] = TType
        data['access_mode'] = AMode
        data['address'] = Address

        sql = self.m.create_new_sql(self.config_info_table, data)
        logger.info('[Model] 生成sql: {}'.format(sql))
        return sql

